﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Client
{
    public partial class FormICSALook : BasePopForm
    {
        public FormICSALook()
        {
            InitializeComponent();
            this.listBoxControl1.SelectedIndexChanged += new EventHandler(listBoxControl1_SelectedIndexChanged);
        }

        void listBoxControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            QunYing.Model.ICSA_Device model = listBoxControl1.SelectedItem as QunYing.Model.ICSA_Device;
            if (model.ICSA设备ID == null)
                return;
            this.BindSingleDevice(model);
          
        }

        public void BindData(List<QunYing.Model.ICSA_Device> device)
        {
            this.listBoxControl1.DataSource = device;
            
        }

        public void BindSingleDevice(QunYing.Model.ICSA_Device device)
        {
            this.txt_ORP传感器.Text = device.ORP传感器.To有无();
            this.txt_ORP门限值.Text = device.ORP门限值.ToString();
            this.txt_PH传感器.Text = device.PH传感器.To有无();
            this.txt_PH门限值.Text = device.PH门限值.ToString();
            this.txt_报警间隔时间.Text = device.报警重复间隔时间.ToString();
            this.txt_定时器1关闭.Text = device.定时器1关闭时间.ToString("HH:mm:ss");
            this.txt_定时器1开启.Text = device.定时器1开启时间.ToString("HH:mm:ss");
            this.txt_定时上报.Text = device.开启定时上报 ? "已开启" : "已关闭";
            this.txt_定时上报时间.Text = device.定时上报时间.ToShortTime();
            this.txt_钙反应传感器.Text = device.钙反应PH传感器.To有无();
            this.txt_钙反应门限值.Text = device.钙反应器PH门限值.ToString();
            this.txt_接警号码.Text = device.报警接收手机号码.ToString();
            this.txt_经销商.Text = device.所属经销商.ToString();

            this.txt_设备类型.Text = device.设备类型.ToString();
            this.txt_水位传感器.Text = device.水位传感器.To有无();
            this.txt_水循环传感器.Text = device.水循环传感器.To有无();

            this.txt_通信号码.Text = device.通信号码.ToString();
            this.txt_温度传感器.Text = device.温度传感器.To有无();
            this.txt_温度门限值.Text = device.温度门限值.ToString();
            this.txt_温控模式.Text = device.温度控制模式.ToString();
            this.txt_氧循环传感器.Text = device.氧循环传感器.To有无();
            this.txt_定时器2开启.Text = device.定时器2开启时间.ToString("HH:mm:ss");
            this.txt_定时器2关闭.Text = device.定时器2关闭时间.ToString("HH:mm:ss");

        }

        private void sharpButton1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
